主题
版本 - Ver
函数简介
返回当前插件版本号。
接口名称
VerDLL调用
long Ver(long ola);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
string val = ola.Ver();csharp
using OLAPlug;
var ola = new OLAPlugServer();
string val = ola.Ver();python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
val = ola.Ver()java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
String val = ola.Ver();cpp
var ola = com("OlaPlug.OlaSoft")
var val = ola.Ver()vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
val = ola.Ver()text
.局部变量 ola, OLAPlug
ola.创建 ()
val = ola.Ver()aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var val = ola.Ver();text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
文本型 val = ola.Ver()cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
string val = ola.Ver();原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long valPtr = Ver(instance);
if (valPtr != 0) {
char val[512] = {0};
GetStringFromPtr(valPtr, val, sizeof(val));
FreeStringPtr(valPtr);
}csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringFromPtr(long ptr, StringBuilder lpString, int size);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FreeStringPtr(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringSize(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
long instance = CreateCOLAPlugInterFace();
long valPtr = Ver(instance);
if (valPtr != 0) {
StringBuilder val = new StringBuilder(GetStringSize(valPtr) + 1);
GetStringFromPtr(valPtr, val, val.Capacity);
FreeStringPtr(valPtr);
string valStr = val.ToString();
}python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
valPtr = Ver(instance)
if valPtr:
buf = create_string_buffer(512)
ola.GetStringFromPtr(valPtr, buf, 512)
ola.FreeStringPtr(valPtr)
val = buf.value.decode("utf-8")返回值
字符串:当前插件的版本描述字符串。
注意事项
- DLL调用返回字符串指针地址,需要调用 FreeStringPtr 接口释放内存。
